<html>
	<head>
		<title>Search</title>
	</head>
	<body>
		<form name="formSearch" method="post" action="Search.php">
			<table width="400" border="0">
				<tr>
					<td>Nhap chuoi tim kiem</td>
					<td><input type="text" name="txtSearchString" /></td>
				</tr>
				<tr>
					<td><input type="submit" name="btnSearch" value="Search" /></td>
				</tr>
			</table>
		</form>
		<?php
			if(isset($_POST["txtSearchString"]))
			{
				$searchstring = $_POST["txtSearchString"];
				$connection = mysql_connect("localhost", "root", "truchung");
				mysql_select_db("dangnhap", $connection);
				$sql = "select * from dangnhap where tendangnhap like '%".$searchstring."%'";
				echo $sql;
				$result = mysql_query($sql, $connection);
				mysql_close($connection);
			
		?>
		<table border = "1">
			<tr>
				<th>STT</th>
				<th>Ten dang nhap</th>
				<th>Mat khau</th>
				<th>Ho ten</th>
				<th>Gioi tinh</th>
				<th>Ngay sinh</th>
				<th>Dia chi</th>
			</tr>
		<?php
			$stt = 0;
			while($row = mysql_fetch_array($result))
			{
				$tendangnhap = $row["TenDangNhap"];
				$matkhau = $row["MatKhau"];
				$hoten = $row["HoTen"];
				$gioitinh = $row["GioiTinh"];
				$ngaysinh = $row["NgaySinh"];
				$diachi = $row["DiaChi"];
				$stt++;
			?>	
				<tr>
				<td>
					<?php
						echo $stt;
					?>
				</td>
				<td>
					<?php
						echo $tendangnhap;
					?>
				</td>
				<td>
					<?php
						echo $matkhau;
					?>
				</td>
				<td>
					<?php
						echo $hoten;
					?>
				</td>
				<td>
					<?php
						if($gioitinh == 1)
							echo ("Nam");
						else
							echo ("Nu");
					?>
				</td>
				<td>
					<?php
						echo $ngaysinh;
					?>
				</td>
				<td>
					<?php
						echo $diachi;
					?>
				</td>
			</tr>
		<?php
			}//ket thuc while
				}//ket thuc if
		?>
		</table>
	</body>
</html>